/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author trung
 */
public class StatisticModel extends AbstractTableModel {
    
    List<entity.Statistic> list;
    
    public StatisticModel(List<entity.Statistic> list){
        this.list = list;
    }
    public final static String[] columnNames = {
        "STT", "Ngày", "Số lượt đặt phòng", "Số lượt trả phòng", "Doanh thu"
    };
    
    public int getRowCount(){
        return this.list.size();
    }
    public int getColumnCount(){
        return columnNames.length;
    }
    


    public Object getValueAt(int row, int col) {
       switch(col){
           case 0 : return row + 1;
           case 1 : return list.get(row).getDate();
           case 2 : return list.get(row).getBookingN();
           case 3 : return list.get(row).getCheckoutN();
           case 4 : return list.get(row).getRevenue();
           default: return null;
       }
    }
    
    public String getColumnName( int columnIndex){
        return columnNames[columnIndex];
    }
    
}
